#Memory slots are very important for several FE8 event commands.
#Memory slot 0x0 always has a value of zero - don't bother setting it otherwise.
#Memory slot 0xB is where the coordinates for many commands are read from.
#Memory slot 0xC is where conditional values are stored - booleans, character IDs, gold count, etc
#Memory slot 0xD indicates the size of a queue (see below); don't modify it with SETVAL

##Stores value to the given MemorySlot.
##To be precise, this command sets a word at
##$030004B8 + (MemorySlot*4). Last MemorySlot is 0xD.
##Aliases: SVAL, SMOV
SETVAL, 0x0540, 8, -game:FE8 -indexMode:8
##The Memory Slot at which to store the given value.
	MemorySlot, 2, 2
##The value to store in the the memory slot.
	Value, 4, 4

##Stores value to the given MemorySlot.
##To be precise, this command sets a word at
##$030004B8 + (MemorySlot*4). Last MemorySlot is 0xD.
##Aliases: SETVAL, SMOV
SVAL, 0x0540, 8, -game:FE8 -indexMode:8
##The Memory Slot at which to store the given value.
	MemorySlot, 2, 2
##The value to store in the the memory slot.
	Value, 4, 4

##Stores value to the given MemorySlot.
##To be precise, this command sets a word at
##$030004B8 + (MemorySlot*4). Last MemorySlot is 0xD.
##Aliases: SETVAL, SVAL
SMOV, 0x0540, 8, -game:FE8 -indexMode:8
##The Memory Slot at which to store the given value.
	MemorySlot, 2, 2
##The value to store in the the memory slot.
	Value, 4, 4



#The 0x062X series of commands perform mathematical operations between memory slots.
#Using macros for these is recommended, it'll make everything easier.
#All these commands have the same parameter format, detailed below.

##command:Slots:ADD
##Adds the value in MemorySlot X with the one in MemorySlot Y
##This command can be used to transfer a value from one
##MemorySlot to another, by having the parameter in '0x00YZ' format.
SADD, 0x0620, 4, -game:FE8 -indexMode:8
##The MemorySlots to use for this operation.
##The format for this parameter is '0x0XYZ', where
##X and Y are the operand slots, and Z is the result slot.
	MemorySlots, 2, 2

##command:Slots:SUBtract
##Subtracts the value in MemorySlot X from the value in MemorySlot Y.
SSUB, 0x0621, 4, -game:FE8 -indexMode:8
##The MemorySlots to use for this operation.
##The format for this parameter is '0x0XYZ', where
##X and Y are the operand slots, and Z is the result slot.
	MemorySlots, 2, 2

##command:Slots:MULtiply
##Multiplies the value in MemorySlot X with the value in MemorySlot Y.
SMUL, 0x0622, 4, -game:FE8 -indexMode:8
##The MemorySlots to use for this operation.
##The format for this parameter is '0x0XYZ', where
##X and Y are the operand slots, and Z is the result slot.
	MemorySlots, 2, 2

##command:Slots:DIVide
##Divides the value in MemorySlot Y by the value in MemorySlot X.
SDIV, 0x0623, 4, -game:FE8 -indexMode:8
##The MemorySlots to use for this operation.
##The format for this parameter is '0x0XYZ', where
##X and Y are the operand slots, and Z is the result slot.
	MemorySlots, 2, 2

##command:Slots:AND
##Performs a binary AND between the values in MemorySlots X and Y.
SAND, 0x0625, 4, -game:FE8 -indexMode:8
##The MemorySlots to use for this operation.
##The format for this parameter is '0x0XYZ', where
##X and Y are the operand slots, and Z is the result slot.
	MemorySlots, 2, 2

##command:Slots:OR
##Performs a binary inclusive OR between the values in MemorySlots X and Y.
SORR, 0x0626, 4, -game:FE8 -indexMode:8
##The MemorySlots to use for this operation.
##The format for this parameter is '0x0XYZ', where
##X and Y are the operand slots, and Z is the result slot.
	MemorySlots, 2, 2

##command:Slots:eXclusive OR
##Performs a binary exclusive OR between the values in MemorySlots X and Y.
SXOR, 0x0627, 4, -game:FE8 -indexMode:8
##The MemorySlots to use for this operation.
##The format for this parameter is '0x0XYZ', where
##X and Y are the operand slots, and Z is the result slot.
	MemorySlots, 2, 2

##command:Slots:Logical Shift Left
##Bitshifts the value in MemorySlot Y by (value in MemorySlot X) bits.
##Alias: SLOTS_LEFTSHIFT
SLSL, 0x0628, 4, -game:FE8 -indexMode:8
##The MemorySlots to use for this operation.
##The format for this parameter is '0x0XYZ', where
##X and Y are the operand slots, and Z is the result slot.
	MemorySlots, 2, 2

##Bitshifts the value in MemorySlot Y by (value in MemorySlot X) bits.
##Alias: SLSL
SLOTS_LEFTSHIFT, 0x0628, 4, -game:FE8 -indexMode:8
##The MemorySlots to use for this operation.
##The format for this parameter is '0x0XYZ', where
##X and Y are the operand slots, and Z is the result slot.
	MemorySlots, 2, 2

##command:Slots:Logical Shift Right
##Bitshifts the value in MemorySlot Y by (value in MemorySlot X) bits.
##Alias: SLOTS_RIGHTSHIFT
SLSR, 0x0629, 4, -game:FE8 -indexMode:8
##The MemorySlots to use for this operation.
##The format for this parameter is '0x0XYZ', where
##X and Y are the operand slots, and Z is the result slot.
	MemorySlots, 2, 2

##Bitshifts the value in MemorySlot Y by (value in MemorySlot X) bits.
##Alias: SLSR
SLOTS_RIGHTSHIFT, 0x0629, 4, -game:FE8 -indexMode:8
##The MemorySlots to use for this operation.
##The format for this parameter is '0x0XYZ', where
##X and Y are the operand slots, and Z is the result slot.
	MemorySlots, 2, 2



##Shifts the first value in the Queue to the given MemorySlot
##and shifts the rest down. Used with 'SAVETOQUEUE'.
SLOTS_SETFROMQUEUE, 0x0722, 4, -game:FE8 -indexMode:8
##This parameter controls which MemorySlot to store the first value to, usually 0x2 or 0xB.
	MemorySlot, 2, 2

##Stores the value in MemorySlot 0x1 as the newest Queue element.
##To be precise, it writes said value to $030004F0 + (4*(amount of words already stored there))
##The register at $030004EC indicates how many words are currently stored in the Queue.
SAVETOQUEUE, 0x721, 4, -game:FE8 -indexMode:8

##Stores the value from the given MemorySlot as the newest Queue element.
##To be precise, it writes said value to $030004F0 + (4*(amount of words already stored there))
##The register at $030004EC indicates how many words are currently stored in the Queue.
STQFROMSLOT, 0x720, 4, -game:FE8 -indexMode:8
##The memory slot holding the value to add to the Queue.
	MemorySlot, 2, 2



#The following commands can initialize, add from, subtract, and store 
#a counter value to memory slot 0xC. Pretty useful.

##Stores the value in the Counter to MemorySlot 0xC.
COUNTER_CHECK, 0x0F20, 4, -game:FE8 -indexMode:8
	Unknown, 2, 2,

##Sets the value in the Counter
COUNTER_SET, 0x0F21, 4, -game:FE8 -indexMode:8
##Amount of bits by which to leftshift the counter value (usually 0).
	BitshiftValue, 2, 1
##The value to set.
	CounterValue, 3, 1

##Adds (Operand)*(2^BitShiftValue) to the value in the Counter.
COUNTER_ADD, 0x0F22, 4, -game:FE8 -indexMode:8
##Amount of bits by which to leftshift the operand (usually 0).
	BitshiftValue, 2, 1
##The value to add.
	Operand, 3, 1

##Subtracts (Operand)*(2^BitshiftValue) from the value in the Counter.
COUNTER_SUBTRACT, 0x0F23, 4, -game:FE8 -indexMode:8
##Amount of bits by which to leftshift the operand (usually 0).
	BitshiftValue, 2, 1
##The value to subtract.
	Operand, 3, 1